﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.ComponentModel;
namespace CoreData
{//phieu thu hoc phi
    public class Receipt_VoucherFee
    {
        [Description("ID")]
            public long ID{get;set;}
        [Description("StudentID")]
            public long StudentID{get;set;}
        public long VoucherID { get; set; }
         [Description("Lần đóng")]
            public string TimeFee{get;set;}
         [Description("Số tiền")]
            public long Money{get;set;}
         public bool IsDeleted { get; set; }
         public int Type { get; set; }
         public long BranchID { get; set; } //chỉ sủ dung cho thu đặt cọc
         public long TempStudentID { get; set; } //chi su dung cho thi dat coc
         [Description("Học viên")]
         public string StudentNameExt { get; set; }
        [Description("Mã phiếu thu")]
         public string ReceiptVoucherCodeExt { get; set; }
        public DateTime ReceiptVoucherCreateDateExt { get; set; }
        public Receipt_VoucherFee()
        {       
                           
        }
        
       static Receipt_VoucherFee DynamicCast<T>(object row_data, object row_header) where T : Receipt_VoucherFee
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           Receipt_VoucherFee ret = new Receipt_VoucherFee();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "StudentID":
                        ret.StudentID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "TimeFee":
                        ret.TimeFee = ConvertObject.ToString(dt[column]);
                       break;
                      case  "Money":
                        ret.Money = ConvertObject.ToLong(dt[column]);              
                       break;
                     
                      case "StudentName":
                       ret.StudentNameExt = ConvertObject.ToString(dt[column]);
                       break;
                   case "IsDeleted":
                       ret.IsDeleted = ConvertObject.ToBool(dt[column]);
                       break;
                   case "VoucherID":
                       ret.VoucherID = ConvertObject.ToLong(dt[column]);
                       break;
                   case "ReceiptNo":
                       ret.ReceiptVoucherCodeExt = ConvertObject.ToString(dt[column]);
                          break;
                   case "Type":
                          ret.Type = ConvertObject.ToInt(dt[column]);
                          break;
                   case "ReceiptVoucherCreateDate":
                          ret.ReceiptVoucherCreateDateExt = ConvertObject.ToDateTime(dt[column]);
                          break;
                   case "BranchID":
                          ret.BranchID = ConvertObject.ToLong(dt[column]);
                          break;
                   case "TempStudentID":
                          ret.TempStudentID = ConvertObject.ToLong(dt[column]);
                          break;
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
